<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 */
	public function index($string=NULL)
	{
		$data['stylesheet'] = '/theme/' ;
		$data['image_path'] = '/theme/images/' ;

		$string = (strpos($string,'-')===0)?substr($string,1):$string ;
		$url_query = explode('-',$string) ;
		$uid = (int)!empty($url_query[0])?$url_query[0]:0 ;
		$page = (int)!empty($url_query[1])?$url_query[1]:0 ;

		$this->load->model('muser');  
		$data['user'] = $this->muser->get_one($uid);  
		if (count((array)$data['user']) == 0) {
			show_404();
			exit();
		}
		$data['head_title'] = $data['user']->username.'分享资源-盘享网' ;
		$data['keywords'] = '' ;
		$data['description'] = '' ;

		$data['lists'] = $this->muser->pagination($uid, $page, $data['totalcount'] ,15);
		$data['pagination'] = pagination('user/index-'.$uid.'-%d',$page, $data['totalcount'],15);
		$data['hots'] = $this->muser->get_hot_list($uid);  

		$this->load->view('header',$data);
		$this->load->view('user_index');
		$this->load->view('footer');
	}
}